package com.xgr.wonderful.fragment;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.xgr.wonderful.R;
import com.xgr.wonderful.activity.base.BaseHomeFragment;
import com.xgr.wonderful.entity.User;
import com.xgr.wonderful.utils.LocalUserUtils;
import com.xgr.wonderful.view.CircleImageView;

public class MyInfoFragment  extends BaseHomeFragment{


	private CircleImageView myAvatar = null;
	private TextView mUsernameTv;
	private TextView mUseridTv;

	private User localUser;
	
	@Override
	protected int getLayoutId() {
		// TODO Auto-generated method stub
		return R.layout.fragment_myinfo;
	}

	@Override
	protected void findViews(View view) {
		mUsernameTv = (TextView)view.findViewById(R.id.myinfo_usernameTv) ;
		mUseridTv = (TextView)view.findViewById(R.id.myinfo_useridTv) ;
		myAvatar = (CircleImageView)view.findViewById(R.id.myinfo_myavatar) ;
	}

	@Override
	protected void setupViews(Bundle bundle) {
		localUser = LocalUserUtils.getInstance().getLocalUser() ;
		mUseridTv.setText(localUser!= null? ""+ localUser.getID(): "0000");
		mUsernameTv.setText(localUser!= null ? ""+localUser.getUsername():"没有登录");
		if (localUser!= null && localUser.getPhoto()!= null && localUser.getPhoto().getSmall()!= null){
			ImageLoader.getInstance().displayImage(
					localUser.getPhoto().getSmall(), 
					myAvatar) ;
		}
	}

	@Override
	protected void setListener() {
		// TODO Auto-generated method stub
		
	}

}
